﻿Imports Microsoft.Xna.Framework.Input
Imports Microsoft.Xna.Framework

''' <summary>
''' Static helper class. Returns a ControlerInputManager if a GamePad is found
''' Otherwise returns a KeyboardInputManager
''' </summary>
''' <remarks>Copied from Example on Y: Drive by John Peppiat</remarks>
Public Class InputManagerFactory

    Private Shared mInputManager As IGamePadInputManager

    Public Shared Function GetInputManager() As IGamePadInputManager
        If mInputManager Is Nothing Then
            If GamePad.GetState(PlayerIndex.One).IsConnected Then
                mInputManager = New GamePadInputManager
            Else
                mInputManager = New KeyboardInputManager
            End If
        End If
        Return mInputManager
    End Function
End Class